﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SDL;

namespace BusinessLogic
{
    public static class UserExtensions
    {
        /*public static UserInfo getNewsById(this string id)
        {
            var n = new UserInfo();
            n["id"] = id.ToString();
            n.Run("News.getById");
            return n.getOne<UserInfo>();
        }*/

        public static UserInfo getByLoginPassword(string login, string password)
        {
            var n = new UserInfo();
            n["login"] = login;
            n["password"] = password;
            n.Run("user.getByLoginPassword");
            return n.getOne<UserInfo>();
        }

        public static List<UserInfo> findUsers(this string query)
        {
            var n = new UserInfo();
            n["query"] = query;
            n.Run("user.find");
            return new List<UserInfo> (n.getList<UserInfo>());
        }
    }
}
